import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpPaper {
  id!: number;
  title!: string;
  type: number = 1;
  typeId: number = 0;
  img!: unknown;
  content!: unknown;
  questionId: number = 0;
  timeLimitType: boolean = true;
  timeLimit: number = 0;
  againTest: boolean = true;
  isSuspend: boolean = true;
  isRanking: boolean = true;
  isAloneSale: number = 1;
  priceType: boolean = true;
  price?: string;
  linePrice?: string;
  isRelationSale?: boolean;
  state: boolean = true;
  uniacid!: number;
  formId: number = 0;
  isCert?: boolean;
  certScore?: number = 0;
  urlType?: number = 1;
  certTitle?: string;
  certImgType?: boolean;
  certImgStyle?: number;
  certImgImg?: unknown;
  certTextType?: boolean;
  certTextStyle?: number;
  certText1?: string;
  certText2?: string;
  certText3?: string;
  sales: number = 0;
  defaultSales: number = 0;
  views: number = 0;
  sort: number = 0;
  addTime!: string;
  updateTime!: string;
  isLable: boolean = false;
  lableTitle?: string;
  lableColor!: string;
  people: number = 0;
}

export const ImsYzdKpPaperSchema = new EntitySchema({
  class: ImsYzdKpPaper,
  properties: {
    id: { primary: true, type: 'number' },
    title: { type: 'string', length: 255 },
    type: { type: 'number', default: 1 },
    typeId: { type: 'number', default: 0 },
    img: { type: 'unknown', columnType: 'longtext' },
    content: { type: 'unknown', columnType: 'longtext' },
    questionId: { type: 'number', default: 0 },
    timeLimitType: { type: 'boolean', default: true },
    timeLimit: { type: 'number', default: 0 },
    againTest: { type: 'boolean', default: true },
    isSuspend: { type: 'boolean', default: true },
    isRanking: { type: 'boolean', default: true },
    isAloneSale: { type: 'number', columnType: 'tinyint', default: 1 },
    priceType: { type: 'boolean', default: true },
    price: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    linePrice: { type: 'string', columnType: 'numeric(10,2)', nullable: true },
    isRelationSale: { type: 'boolean', nullable: true },
    state: { type: 'boolean', default: true },
    uniacid: { type: 'number' },
    formId: { type: 'number', default: 0 },
    isCert: { type: 'boolean', nullable: true },
    certScore: { type: 'number', nullable: true, default: 0 },
    urlType: { type: 'number', nullable: true, default: 1 },
    certTitle: { type: 'string', length: 255, nullable: true },
    certImgType: { type: 'boolean', nullable: true },
    certImgStyle: { type: 'number', nullable: true },
    certImgImg: { type: 'unknown', columnType: 'longtext', nullable: true },
    certTextType: { type: 'boolean', nullable: true },
    certTextStyle: { type: 'number', nullable: true },
    certText1: { type: 'string', fieldName: 'cert_text_1', length: 255, nullable: true },
    certText2: { type: 'string', fieldName: 'cert_text_2', length: 255, nullable: true },
    certText3: { type: 'string', fieldName: 'cert_text_3', length: 255, nullable: true },
    sales: { type: 'number', default: 0 },
    defaultSales: { type: 'number', default: 0 },
    views: { type: 'number', default: 0 },
    sort: { type: 'number', default: 0 },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    isLable: { type: 'boolean', default: false },
    lableTitle: { type: 'string', length: 255, nullable: true },
    lableColor: { type: 'string', length: 255 },
    people: { type: 'number', default: 0 },
  },
});
